//
//  ALSShareSDK.h
//  第三方组件原生的分享
//
//  Created by isenu on 16/9/21.
//  Copyright © 2016年 isenu. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, PayType) {
    weChatPay  = 0,        /**< 微信支付      */
    aLiPay     = 1,        /**< 支付宝支付    */
};

typedef NS_ENUM(NSInteger, LoginType) {
    weChatLogin  = 0,        /**< 微信登录      */
    weiBoLogin   = 1,        /**< 微博登录      */
    qqLogin      = 2,        /**< QQ登录       */
};

typedef NS_ENUM(NSInteger, WXShareScene) {
    WXShareSceneSession  = 0,        /**< 聊天界面    */
    WXShareSceneTimeline = 1,        /**< 朋友圈      */
    WXShareSceneFavorite = 2,        /**< 收藏       */
};

typedef NS_ENUM(NSInteger, QQShareScene) {
    QQShareSceneSession = 0,        /**< 聊天界面    */
    QQShareSceneQZone   = 1,        /**< 朋友圈      */
};

typedef NS_ENUM(NSInteger, WeiboShareScene) {
    WeiboShareSceneSession  = 0,    /**< 聊天界面    */
    WeiboShareSceneTimeline = 1,    /**< 朋友圈   */
};

////////////////////////////////////////  ALSShareResponse  /////////////////////////////////////////////
@interface ALSShareResponse : NSObject
/*
 * 第三方分享是否成功
 */
@property (nonatomic, assign, getter=isSucess, readonly) BOOL success;
/*
 * 第三方分享错误原因
 */
@property (nonatomic, copy, readonly) NSString *errorStr;

@end

////////////////////////////////////////  ALSLoginResponse  /////////////////////////////////////////////
@interface ALSLoginResponse : NSObject
/*
 * 第三方登录是否成功
 */
@property (nonatomic, assign, getter=isSucess, readonly) BOOL success;

/*
 * 第三方登录的错误原因
 */
@property (nonatomic, copy, readonly) NSString *errorString;

/*
 * 第三方的唯一标识
 */
@property (nonatomic, copy, readonly) NSString *uid;

/*
 * 第三方的个人信息
 */
@property (nonatomic, copy, readonly) NSDictionary *userInfo;

@end

////////////////////////////////////////  ALSPayResponse  /////////////////////////////////////////////
@interface ALSPayResponse : NSObject
/*
 * 第三方支付是否成功
 */
@property (nonatomic, assign, getter=isSucess, readonly) BOOL success;

/*
 * 第三方支付的错误原因
 */
@property (nonatomic, copy, readonly) NSString *errorString;

@end

////////////////////////////////////////  ALSSDK   ////////////////////////////////////////////
@interface ALSSDK : NSObject

+ (instancetype)defaultShareSDK;

+ (void)registerWeChatAppid:(NSString *)wxAppId secret:(NSString *)wxSecret;
+ (void)registerQQApp:(NSString *)qqAppId secret:(NSString *)qqSecret;
+ (void)registerWeiboApp:(NSString *)wbAppKey secret:(NSString *)wbSecret redirectURI:(NSString *)redirectURI;

+ (BOOL)handleOpenURL:(NSURL *)url;

/***************************************    支付   ******************************/
#pragma mark - 第三方支付
/*
 * payType:支付的方式
 * resultDict:支付订单的内容(带有6个标准参数的NSDictionary)
 * finished:支付之后的回调
 */
- (void)ALSPayInformation:(NSDictionary *)resultDict PayType:(PayType)payType finished:(void(^)(ALSPayResponse *response))finished;

/***************************************    登录   ******************************/
#pragma mark - 第三方登录
/*
 * loginType:登录的方式
 * finished:登录之后的回调
 */
- (void)ALSLoginType:(LoginType)loginType
            finished:(void(^)(ALSLoginResponse *response))finished;



/***************************************    分享   ******************************/

#pragma mark - 微信分享 [文字不可以分享到朋友圈]
+ (void)weChatShareText:(NSString *)text
               finished:(void(^)(ALSShareResponse *response))finished;

+ (void)weChatShareThumbImage:(UIImage *)thumbImage
                originalImage:(NSData *)originalImageData
                        scene:(WXShareScene)scene
                     finished:(void(^)(ALSShareResponse *response))finished;

+ (void)weChatShareWebURL:(NSString *)url
              description:(NSString *)description
               thumbImage:(UIImage *)thumbImage
                    title:(NSString *)title
                    scene:(WXShareScene)scene
                 finished:(void(^)(ALSShareResponse *response))finished;

+ (void)weChatShareMusicURL:(NSString *)musicUrl
               musicDataURL:(NSString *)musicDataUrl
                 thumbImage:(UIImage *)thumbImage
                      title:(NSString *)title
                description:(NSString *)description
                      scene:(WXShareScene)scene
                   finished:(void(^)(ALSShareResponse *response))finished;

+ (void)weChatShareVideoURL:(NSString *)videoUrl
                 thumbImage:(UIImage *)thumbImage
                      title:(NSString *)title
                description:(NSString *)description
                      scene:(WXShareScene)scene
                   finished:(void(^)(ALSShareResponse *response))finished;


#pragma mark - 手机QQ分享  [只有`新闻`(网页)和音乐可以分享到朋友圈]
+ (void)qqShareText:(NSString *)text
            finshed:(void(^)(ALSShareResponse *response))finished;

+ (void)qqShareImage:(NSData *)previewImageData
       originalImage:(NSData *)originalImageData
               title:(NSString *)title
         description:(NSString *)description
            finished:(void(^)(ALSShareResponse *response))finished;

+ (void)qqShareWebURL:(NSString *)url
          description:(NSString *)description
           thumbImage:(NSData *)thumbImageData
                title:(NSString *)title
                scene:(QQShareScene)scene
             finished:(void(^)(ALSShareResponse *response))finished;

/// 分享音乐到QQ previewImageUrl 和 previewImageData只需要有一个即可
+ (void)qqShareMusicURL:(NSString *)flashUrl
                jumpURL:(NSString *)jumpUrl
        previewImageURL:(NSString *)previewImageUrl
       previewImageData:(NSData *)previewImageData
                  title:(NSString *)title
            description:(NSString *)description
                  scene:(QQShareScene)scene
               finished:(void(^)(ALSShareResponse *response))finished;

#pragma mark - 微博分享
+ (void)weiboShareText:(NSString *)text
                 scene:(WeiboShareScene)scene
              finished:(void(^)(ALSShareResponse *response))finished;

+ (void)weiboShareImage:(NSData *)imageData
                  scene:(WeiboShareScene)scene
                finshed:(void(^)(ALSShareResponse *response))finished;

+ (void)weiboShareWebURL:(NSString *)url
                   title:(NSString *)title
             description:(NSString *)description
              thumbImage:(NSData *)thumbImageData
                   scene:(WeiboShareScene)scene
                finished:(void(^)(ALSShareResponse *response))finished;
/// 只支持分享 `音乐🎵` 到朋友圈
+ (void)weiboShareMusicURL:(NSString *)url
                 streamURL:(NSString *)streamUrl
                     title:(NSString *)title
               description:(NSString *)description
             thumbnailData:(NSData *)thumbnailData
                  finished:(void(^)(ALSShareResponse *response))finished;

/// 只支持分享 `视频📺` 到朋友圈
+ (void)weiboShareVideoURL:(NSString *)url
                 streamURL:(NSString *)streamUrl
                     title:(NSString *)title
               description:(NSString *)description
             thumbnailData:(NSData *)thumbnailData
                  finished:(void(^)(ALSShareResponse *response))finished;





@end
